#define GFX_W 1000
#define GFX_H 800
#define NB_IMAGES 3

typedef struct {
int x,y,w,h;
}variable;

typedef struct
{ int x;
  int y;
 
  BITMAP * img_right[NB_IMAGES];
  BITMAP * img_left[NB_IMAGES];
  int direction; // 0: right 1:left 2:up 
}Personnage;

typedef struct
{
 int x;
 int y;
BITMAP *image;
BITMAP *image1;
int affiche;
} epine;


int get_pixel(BITMAP* Buffer,int x,int y);

//Module Background
BITMAP* load_background_bmp(char chemin_background[]);
void draw_background(BITMAP *Background,BITMAP*Buffer,int j);
void destroy_background(BITMAP * Background);


//Module grace
void load_grace(Personnage *p);
void destroy_grace(Personnage *p);
void init_grace(Personnage *p);

void move_grace_right(Personnage *p,int *compteur,BITMAP * Background,int *j,int *move);
void move_grace_left(Personnage *p,int *compteur,BITMAP * Background,int j);
void jump_grace(Personnage *p,BITMAP * Background,int j,int *test); 

void gravity_grace(Personnage *p,BITMAP * Background,int j);// gravité


void move_grace(Personnage *p,int *compteur,BITMAP * Background, int *j,int * move,int *test);
void draw_grace(Personnage p,BITMAP *Buffer, int compteur);

// les collisions
int collision_background_right(variable v,BITMAP* BackgroundCol,int o);
int collision_background_left(variable v,BITMAP* BackgroundCol,int o);
int collision_background_down(variable v,BITMAP* BackgroundCol, int o);
int collision_background_up(variable v,BITMAP* BackgroundCol, int o);


int collision(int x1,int y1,int w1,int h1,int x2,int y2,int w2,int h2);

//Son
void soundm();
